import unittest
import requests
import HTMLTestReportCN
class mainfile(unittest.TestCase):

    def setUp(self):
        login_url = "https://www-api2.tctest0.com/v2/user/auth/login"
        login_headers = {'User-Agent': 'TC/2.0.4 (iPhone; iOS 11.0.3; Scale/3.00)','Content-Type': 'application/json'}
        login_params = {"name":"13333333333","password":"111111"}
        self.login_respones = requests.post(url=login_url, json=login_params,headers=login_headers)
        self.token_get = self.login_respones.json().get('data').get('token')

        # trytoplay_post_url = "https://www-api2.gpmine.com/v2/user/auth/trytoplay"
        # trytoplay_post_params = {'token': self.token_get, 'verify': '1240'}
        # trytoplay_post_headers = {'Content-Type': 'application/json', 'User-Agent': 'TC/2.0.4 (iPhone; iOS 11.0.3; Scale/3.00)'}
        # self.trytoplay_post_respones = requests.post(url=trytoplay_post_url, json=trytoplay_post_params, headers=trytoplay_post_headers)
        # self.token_post = self.trytoplay_post_respones.json().get('data').get('auth').get('token')


    def test_login_trytoplay_get(self):
        self.assertEqual(self.login_respones.status_code, 200)
        self.assertEqual(self.login_respones.json().get('message'), 'ok')
    #
    # def test_login_trytoplay_post(self):
    #     self.assertEqual(self.trytoplay_post_respones.status_code,200)
    #
    # def test_login_wallet(self):
    #     login_wallet_url = "https://www-api2.gpmine.com/v2/user/auth/trytoplay"
    #     login_wallet_headers = {'User-Agent': 'TC/2.0.4 (iPhone; iOS 11.0.3; Scale/3.00)'}
    #     self.trytoplay_get_respones = requests.get(url=trytoplay_get_url, headers=trytoplay_get_headers)
    #     self.token_get = self.trytoplay_get_respones.json().get('data').get('token')
    #


    # def test_list(self):
    #     list_url = "https://system.sanduspace.com/v1/base/brand/company/list"
    #     list_data = {'companyId': self.companyId, 'userId': self.usgId}
    #     list_headers = {'Authorization': self.Authorization, 'Platform-Code': 'merchantManage'}
    #     list_response = requests.get(url=list_url, params=list_data, headers=list_headers)
    #     self.assertEqual(list_response.status_code, 200)
    #     self.assertEqual(list_response.json().get('message'),'ok')
    #     # print(list_response.status_code)
    #     # print(list_response.text)
    #
    # def test_user(self):
    #     user_url = "https://system.sanduspace.com/v1/sys/eiu/user"
    #     user_params = {'id': self.companyId, 'userId': self.usgId}
    #     user_headers = {'Authorization': self.Authorization, 'Platform-Code': 'merchantManage'}
    #     user_response = requests.get(url=user_url, params=user_params, headers=user_headers)
    #     self.assertEqual(user_response.status_code, 200)
    #     self.assertEqual(user_response.json().get('message'),'详情获取成功!')
    #     # print(user_response.status_code)
    #     # print(user_response.text)
    #
    # def test_area_list(self):
    #     area_list_url = "https://system.sanduspace.com/v1/base/area/list"
    #     area_list_data = {"areaCode": 0, "userId": self.usgId}
    #     area_list_headers = {'Content-Type': 'application/json', 'Authorization': self.Authorization,
    #                          'Platform-Code': 'merchantManage'}
    #     area_list_response = requests.post(url=area_list_url, json=area_list_data, headers=area_list_headers)
    #     self.assertEqual(area_list_response.status_code, 200)
    #     self.assertEqual(area_list_response.json().get('message'),'ok')
    #     self.assertEqual(area_list_response.json().get('totalCount'),34)
    #     # print(area_list_response.status_code)
    #     # print(area_list_response.text)
    #
    #
    # def test_getCompanyType(self):
    #     getCompanyType_url = "https://system.sanduspace.com/v1/company/shop/getCompanyType"
    #     getCompanyType_params = {'companyId': self.companyId, 'userId': self.usgId}
    #     getCompanyType_headers = {'Content-Type': 'application/json', 'Authorization': self.Authorization,
    #                               'Platform-Code': 'merchantManage'}
    #     getCompanyType_response = requests.post(url=getCompanyType_url, json=getCompanyType_params,headers=getCompanyType_headers)
    #     self.assertEqual(getCompanyType_response.status_code, 200)
    #     self.assertEqual(getCompanyType_response.json().get('message'),'ok')
    #     # print(getCompanyType_response.status_code)
    #     # print(getCompanyType_response.text)

    def tearDown(self):
        #print('接口测试通过')
        pass

if __name__ == "__main__":
    unittest.main()